'''
Created on Oct 15, 2009

@author: mkiyer
'''

from optparse import OptionParser
from veggie.sample.sampledb2 import get_sampledb
import sys
import logging

if __name__ == '__main__':
    logging.basicConfig(level=logging.CRITICAL)
    
    optionparser = OptionParser("usage: %prog [options]")
    optionparser.add_option("--fc", "--flowcell", dest="flowcell",
                            help="flowcell id")
    optionparser.add_option("--lane", dest="lane", type="int",
                            help="lane id")
    optionparser.add_option("-a", "--all", action="store_true",
                            default=False,
                            help="find all fastq files associated with this sample")

    (options, args) = optionparser.parse_args()
    if not args:
        pass
    if not options.flowcell:
        optionparser.error('no flowcell specified')
    if not options.lane:
        optionparser.error('no lane specified')

    best_fastqs = get_sampledb().find_fastq(options.flowcell, options.lane)
    sys.stdout.write(' '.join(best_fastqs))

    
